package com.huawei.appmarket.service.settings.card;

import android.content.Context;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.Switch;
import android.widget.TextView;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant.KeyAndValue;
import huawei.widget.HwSwitch;
import o.cep;
import o.cgz;
import o.czw;
import o.der;
import o.der.f;
import o.dge.d;
import o.dgh;
import o.dss;
import o.eqp;
import o.NetWorkUtil;
import o.MinimumFactory;

public class SettingAutoUpdateCard extends BaseSettingCard {
    private czw ˊ;
    private TextView ˋ;
    private TextView ˎ;
    private Switch ॱ;

    class c implements OnCheckedChangeListener {
        final /* synthetic */ SettingAutoUpdateCard ॱ;

        private c(SettingAutoUpdateCard settingAutoUpdateCard) {
            this.ॱ = settingAutoUpdateCard;
        }

        public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
            String str;
            boolean isChecked = this.ॱ.ॱ.isChecked();
            if (this.ॱ.ˊ != null) {
                this.ॱ.ˊ.ॱ(isChecked);
            }
            String userId = UserSession.getInstance().getUserId();
            String ॱ = eqp.ॱ();
            d dVar = new d(this.ॱ.ᐝ, f.ꞌ);
            if (isChecked) {
                str = "02" + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + userId + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + ॱ;
            } else {
                str = KeyAndValue.NUMBER_01 + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + userId + HiAnalyticsConstant.REPORT_VAL_SEPARATOR + ॱ;
            }
            dgh.onEvent(dVar.ˏ(str).ˋ());
        }
    }

    public SettingAutoUpdateCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        super.ˏ(view);
        this.ˎ = (TextView) view.findViewById(der.d.ʽʼ);
        this.ˋ = (TextView) view.findViewById(der.d.ʽʻ);
        this.ˎ.setText(NetWorkUtil.getWifiResId(this.ᐝ.getApplicationContext(), f.ˏˌ));
        this.ˋ.setText(NetWorkUtil.rebuildWifiKey(this.ᐝ.getString(f.ˋʿ, new Object[]{MinimumFactory.setMinimumFt(80), MinimumFactory.setMinimumFt(30)})));
        this.ॱ = (HwSwitch) view.findViewById(der.d.ˇ);
        if (cep.ˏ()) {
            this.ॱ.setChecked(dss.ॱ().ˎ());
        } else {
            dss.ॱ().ˋ(false);
            this.ॱ.setChecked(false);
        }
        this.ॱ.toggle();
        this.ˊ = new czw(this.ᐝ, this.ॱ);
        this.ॱ.setOnCheckedChangeListener(new c());
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cep.ˏ()) {
            boolean ˎ = dss.ॱ().ˎ();
            if (this.ॱ.isChecked() != ˎ) {
                this.ॱ.setChecked(ˎ);
            }
        } else if (this.ॱ.isChecked()) {
            this.ॱ.setChecked(false);
        }
    }
}
